package com.usooft.metaTalent.core.base.util;


import com.usooft.framework.core.utils.FunctionUtils;
import com.usooft.framework.core.utils.MapBuilder;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

public class FunctionPlusUtils extends FunctionUtils {

    public static <T> List<Map<Object, Object>> pickAll(List<T> list, Function<T, Map<Object, Object>> mapper) {
        if (list != null && list.size() > 0) {
            return list.stream()
                    .map(o -> MapBuilder.builder()
                            .putAll(mapper.apply(o))
                            .build())
                    .toList();
        } else {
            return List.of();
        }

    }

}